﻿using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Microsoft.Extensions.DependencyInjection;
using Wpf.Ui;
using Wpf.Ui.Controls;
using Wpf.Ui.Extensions;
using MetaView.Ticket.Models.Pages;

namespace MetaView.Ticket.ViewModels.Pages;

public partial class DashboardViewModel : ObservableObject
{
    [ObservableProperty]
    public DashboardModel? dashboardModels;

    public DashboardViewModel()
    {
        DashboardModels = new DashboardModel();
    }

    [RelayCommand]
    private void CounterIncrement()
    {
        DashboardModels!.Counter++;

        //弹框
        App.Current.Services.GetRequiredService<ISnackbarService>().Show(
            "不要责怪自己", "每一天都是新的开始，每一天都有无限的可能性!",
            ControlAppearance.Success,
            new SymbolIcon(SymbolRegular.Fluent24),
            TimeSpan.FromSeconds(3));

        //提示框
        new Wpf.Ui.Controls.MessageBox
        {
            Title = "提示：",
            Content = "每一天都是新的开始，每一天都有无限的可能性!",
        }.ShowDialogAsync();

    }

    [RelayCommand]
    private void ShowDialog()
    {
        //对话框
        var result = App.Current.Services.GetRequiredService<IContentDialogService>().ShowSimpleDialogAsync(
               new SimpleContentDialogCreateOptions()
               {
                   Title = "Save your work?",
                   Content = "这里是自定义Content.",
                   PrimaryButtonText = "Save",
                   //SecondaryButtonText = "Don't Save",
                   CloseButtonText = "Cancel",
               }
         );
    }
}
